export default {
	init() {
		const AK = "274BZ-KCY6X-SYA4F-Z432M-WCFA6-GFFQ7";
		const TMAP_URL = "https://map.qq.com/api/gljs?v=1.exp&key=" + AK + "&callback=onTMapCallback&libraries=tools";
		
		return new Promise((resolve, reject) => {
			if (typeof TMap !== "undefined") {
				resolve(TMap);
				return true;
			}
			window.onTMapCallback = function() {
				resolve(TMap);
			}

			let scriptNode = document.createElement("script");
			scriptNode.setAttribute("type", "text/javascript");
			scriptNode.setAttribute("src", TMAP_URL);
			document.body.appendChild(scriptNode);
		});
	}
}